package com.bdqn.SJ3CGLIB;

import com.bdqn.Sj3JDK.IntermediaryInvocationHandler;
import org.apache.log4j.Logger;
import org.springframework.cglib.proxy.Enhancer;

import java.lang.reflect.Proxy;

public class IntermediaryJdkProxyFactory<T> {

    private static IntermediaryMethodInterceptor callback=new IntermediaryMethodInterceptor();


    public static <T> T create(Class<T> targets){
        Enhancer enhancer=new Enhancer();
        enhancer.setCallback(callback);
        enhancer.setSuperclass(targets);
        return (T)enhancer.create();
    }
}
